Conditions | 2 |
Total Lines | 41 |
Code Lines | 27 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { |
||
27 | |||
28 | @Post() |
||
29 | @Roles(UserRole.PHOTOGRAPHER) |
||
30 | @ApiOperation({ summary: 'Create new school' }) |
||
31 | public async index(@Body() dto: SchoolDTO) { |
||
32 | const { |
||
33 | reference, |
||
34 | name, |
||
35 | address, |
||
36 | zipCode, |
||
37 | city, |
||
38 | email, |
||
39 | phoneNumber, |
||
40 | numberOfClasses, |
||
41 | numberOfStudents, |
||
42 | observation, |
||
43 | status, |
||
44 | type |
||
45 | } = dto; |
||
46 | |||
47 | try { |
||
48 | const id = await this.commandBus.execute( |
||
49 | new CreateSchoolCommand( |
||
50 | reference, |
||
51 | name, |
||
52 | address, |
||
53 | zipCode, |
||
54 | city, |
||
55 | status, |
||
56 | type, |
||
57 | email, |
||
58 | phoneNumber, |
||
59 | numberOfStudents, |
||
60 | numberOfClasses, |
||
61 | observation |
||
62 | ) |
||
63 | ); |
||
64 | |||
65 | return { id }; |
||
66 | } catch (e) { |
||
67 | throw new BadRequestException(e.message); |
||
68 | } |
||
71 |